<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%  
  response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
  response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
  response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
  response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility
  String baseURL = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>渠道-首页</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/FusionCharts/FusionCharts.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/channelTariffs/js/menu.js"></script>
<link rev="stylesheet" media="all" href="<%=request.getContextPath()%>/fare/channelTariffs/inclub/style.css" type="text/css" rel="stylesheet">
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/json2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/common.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<style type="text/css">

.ahover{
	display:block;
	width:64px;
	padding-top:10px;
	background:#535353;
	color:#FFF;
}

.akill {poorfish:expression(this.onclick=function kill(){
			return false;
		}
	)}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$('#fromCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	$('#toCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	var hsope_Time = $("#hsope_Time").val();
	var nowdate = new Date();
	var nowMonthStr = nowdate.getMonth()+"";
	var nowDstr;
	if(nowMonthStr.length==1){
		nowDstr = nowdate.getFullYear()+"-0"+Number(nowdate.getMonth()+1)+"-"+nowdate.getDate();
	}else{
	    nowDstr = nowdate.getFullYear()+"-"+Number(nowdate.getMonth()+1)+"-"+nowdate.getDate();
	}
	if(hsope_Time!=""){
		$("#sope_Time").val(hsope_Time);
	}
	if(nowDstr==hsope_Time){
		$("#timetd1").css("background","#535353");
	}else{
		$("#timetd4").css("background","#535353");
	}
	
});

  function sWeekDate(){
	 /*  var sope_Time = $("#sope_Time").val()*1+1;
	  $("#sope_Time").val(sope_Time);  */
	  $("#ctform").attr("action","channelTariffsAction!toCtJsp.action");
	  $("#ctform").submit();
	 // loadAndDisplay('channelTariffsAction!getChioceDateByshow.action');
  }
  
  function seach(){
	  var fromCity= $('#fromCity').val();
	  var toCity  = $('#toCity').val();
	  if(fromCity=="" || toCity =="" || fromCity=="中文/拼音" || toCity =="中文/拼音"){
			alert("航段不能为空");
			return false;
		}
	  if(fromCity==toCity){
		  alert("出发地不能和目的地相同");
		  return false;
	  }
	  $("#ctform").attr("action","channelTariffsAction!toCtJsp.action");
	  $("#ctform").submit();
  }
  
  function showBydate(obj){
	  var date =  obj.substring(0,5);
	  
	  var now = new Date();//30天第一天
 	    //now.setMonth(now.getMonth()-1);//默认多一个月所以应减去一个月
 	    //now.setDate(now.getDate()+2);
 	    //去掉时分秒只比较到天
 	    var nowDateStr = now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate();
 	    nowDateStr = nowDateStr.split('-');
 	    var newDateTonow = new Date(nowDateStr[0],nowDateStr[1],nowDateStr[2]);
 	    var newDate = new Date();//最后一天
 	    var chioceDate="";
 	    var arys;
 	   chioceDate = now.getFullYear()+"-"+date.replace("/","-");
	    	arys = chioceDate.split('-');     
	    	newDate = new Date(arys[0], arys[1]-1, arys[2]);
		if(newDate.getTime() < newDateTonow.getTime()){
			return;
		}
		
      $("#hdate").val(date);
  	  $("#sope_Time").val(chioceDate); 
  	  $("#ctform").attr("action","channelTariffsAction!toCtJsp.action");
	  $("#ctform").submit();  
       // sWeekDate();
  }
  
   function  DateAdd(interval,number,date)  
  {  
   /* 
   *   功能:实现VBScript的DateAdd功能. 
   *   参数:interval,字符串表达式，表示要添加的时间间隔. 
   *   参数:number,数值表达式，表示要添加的时间间隔的个数. 
   *   参数:date,时间对象. 
   *   返回:新的时间对象. 
   *   var   now   =   new   Date(); 
   *   var   newDate   =   DateAdd( "d ",5,now); 
   *---------------   DateAdd(interval,number,date)   ----------------- 
   */  
          switch(interval)  
          {  
                   case   "y "   :   {  
                          date.setFullYear(date.getFullYear()+number);  
                          return   date;  
                           break;  
                   }  
                   case   "q "   :   {  
                           date.setMonth(date.getMonth()+number*3);  
                           return   date;  
                           break;  
                   }  
                  case   "m "   :   {  
                          date.setMonth(date.getMonth()+number);  
                          return   date;  
                          break;  
                   }  
                   case   "w "   :   {  
                           date.setDate(date.getDate()+number*7);  
                           return   date;  
                           break;  
                  }  
                   case   "d "   :   {  
                           date.setDate(date.getDate()+number*1);
                           return   date;  
                           break;  
                   }  
                   case   "h "   :   {  
                           date.setHours(date.getHours()+number);  
                           return   date;  
                           break;  
                  }  
                   case   "mi "   :   {  
                           date.setMinutes(date.getMinutes()+number);  
                           return   date;  
                           break;  
                   }  
                   case   "s "   :   {  
                           date.setSeconds(date.getSeconds()+number);  
                           return   date;  
                           break;  
                  }  
                   default   :   {  
                           date.setDate(d.getDate()+number);  
                           return   date;  
                           break;  
                   }  
          }  
 }


  
  //getChioceDateByshow
  function loadAndDisplay(url){
	    //var tmp =$('#sope_Time').val()*1+1;
	    var tmp =$('#sope_Time').val();
		$.ajax({
	        url : url,
	        data:{
	        	sope_Time:tmp        
	        	},
	        cache : false, 
	        async : false,
	        type : "POST",
	       	complete: function(jqXHR, textStatus){
	       		var result = parseObj(jqXHR.responseText);
	       	    var strs = new Array();
	       	    strs = result.toString().split(",");
	       	    for(var i=0;i<strs.length;i++){
	 				$('#timetd'+Number(i+1)).html("<a href=\"#\" onclick=\"showBydate(\'"+strs[i]+"\')\">"+strs[i]+"</br></a>");
	       	    }
	       	 $("#timetd1").css("background","");  
	       	 $("#timetd4").css("background","#535353");
	       	   /*  if(strs.length>0){
	       	    	$('#timetd1').html("<a href=\"#\" onclick=\"showBydate(\'"+strs[0]+"\')\">"+strs[0]+"</br></a>");
	       	    }
	       	    } */	       	   
	       	}
	    });
	}
  
  var encryption = function(){
	  		var date = new Date();    
	  		var times1970 = date.getTime();    
	  		var times = date.getDate() + "" + date.getHours() + "" + date.getMinutes() + "" + date.getSeconds();    
	  		var encrypt = times * times1970;    
	  		if(arguments.length == 1){        
		 	 return arguments[0] + encrypt;    
		  	}else{        
			  	return encrypt;    
			  }
	  	}
  var randMath=encryption();
  function toSaveHothx(){
	  var fromCity= $('#fromCity').val();
	  var toCity  = $('#toCity').val();
	  if(fromCity=="" || toCity =="" || fromCity=="中文/拼音" || toCity =="中文/拼音"){
			alert("航段不能为空");
			return;
		}
	  if(fromCity==toCity){
		  alert("出发地不能和目的地相同");
		  return;
	  }
	   $.post('<%=request.getContextPath()%>/loginPackage/popularRoutesAction!savePopularRoutesEntityVo.action',
			   $("#ctform").serialize(),function(data){
		    if(data.sf=="same"){
		    	alert("已有相同航线设置");
		    	return;
		    }
			if(data.fromcityCode){
				alert('设置成功');
			    $("#addLi").html("<a href='#' onclick='loadDataByHx("+data.fromcityCode+data.tocityCode+")' style='text-align:left;font-family: 微软雅黑;font-size: 12px;'>"+data.fromcityname+"-"+data.tocityname+"</a><a style='margin-top: -30px;margin-left: 61px;' href='#' onclick='delPopularRoutes('"+data.prid+"')'>删除</a>");
		//<a style="margin-top: -30px;margin-left: 61px;" href="#" onclick="delPopularRoutes('data.prid')">删除</a>
			$("#addLi").css("display","block");
			}else{
				alert('设置失败');
			}
	},'json');
  }
  
  function loadShowData(){
	  $("#ctform").attr("action","channelTariffsAction!toCtJsp.action");
	  $("#ctform").submit();
  }
  
  function delPopularRoutes(prid){
	  $("#ctform").attr("action","channelTariffsAction!delPr.action?prid="+prid);
	  $("#ctform").submit();
  }
  
  function loadDataByHx(codeName){
	  	var fromCode = codeName.substring(0,3);
	  	var toCode   = codeName.substring(3,6);
	  	$("#ctform").attr("action","channelTariffsAction!toCtJsp.action?fromCityStr="+fromCode+"&toCityStr="+toCode);
		$("#ctform").submit();
  }
  
  function loadByplSoce(){
	  var plSope = $("#plSope").val();
	  $("#ctform").attr("action","channelTariffsAction!loadByplSoce.action?sid="+plSope);
	  $("#ctform").submit();
  }
  
  function changeDateByWd(){
	  var sope_Time = $("#sope_Time").val();
	  if(sope_Time!="" && sope_Time!="0"){
		  alert(sope_Time);
	  }
  }
</script>
</head>
<%-- <%@ include file="../../inc/header.jsp"%> --%>
<jsp:include page="/pages/system/feedback/feedback.jsp" ></jsp:include>
<body>
<form action="" id="ctform" name="ctform" method="post">
<input type="hidden" id="hdate" name="hdate"/>
<div class="widthmd">
<div class="header">
<img src="<%=request.getContextPath() %>/fare/image/logo2.jpg"><span>恒拓运价魔方</span>
<p class="day">今天是2013年1月28日，你好！${user.userName } &nbsp;&nbsp;&nbsp;&nbsp;<a href="#">账户管理</a>&nbsp;&nbsp;&nbsp;  <a href="#">帮助</a> &nbsp;&nbsp;&nbsp; <a href="#">消息</a>  &nbsp;&nbsp;&nbsp;<a href="#">退出</a> </p></div>
<div class="main">
<div class="sideBar">
<div class="sideBar1">
<p class="check_P"><input name="" type="checkbox" value="" checked="checked"/> 全航线</p>
<p class="check_P1">
<div style="font-family: 微软雅黑;font-size: 18px;">
<span class="sp_f">区域选择</span></div>
<select name="plSope" id="plSope" class="selectww selectww2">
 <option>请选择</option>
  <c:forEach var="itemfse" items="${listFdcSysAreaEntity}">
	<option value="${itemfse.code}">${itemfse.name}</option>
</c:forEach>
 </select>
 </p>
 </div>
 <div class="line_bg"></div>	
 <div class="sideBar1">
 <div style="font-family: 微软雅黑;font-size: 18px;"><span class="sp_f">热门航线</span></div>
 <ul class="chan_ul">
  <c:forEach var="itemsPopularRoutes" items="${popularRoutes}" varStatus="stat">
 <li>
 <a href="#" onclick="loadDataByHx('${itemsPopularRoutes.fromcityCode}${itemsPopularRoutes.tocityCode}')" style="text-align:left;font-family: 微软雅黑;font-size: 12px;">${itemsPopularRoutes.fromcityname}-${itemsPopularRoutes.tocityname}</a>
 <a style="margin-top: -30px;margin-left: 61px;" href="#" onclick="delPopularRoutes('${itemsPopularRoutes.prid}')">删除</a>
</li>
</c:forEach>
<li id="addLi" style="display: none;">
	
</li>
 </ul>
  <br/>
 </div>
 <div class="line_bg"></div>
  <div class="sideBar1">
 <p class="check_P1">
<div style="font-family: 微软雅黑;font-size: 18px;"><span class="sp_f">航线选择</span></div><br/>
<%-- <select name="fromCity" id="fromCity" class="selectww selectww2">
 <option>出发城市</option>
 </select> --%>
 <input type="text" style="width: 100px" id="fromCity" value="" name="fromCity"/> 
<%--  <select name="toCity" id="toCity" class="selectww selectww2 mg">
 <option>到达城市</option>
 </select> --%><br/><br/>
 <input type="text" style="width: 100px" id="toCity" value="" name="toCity"/>
 </p> <br/><br/>
 
 <img style="cursor: pointer;" onclick="toSaveHothx()" src="<%=request.getContextPath()%>/fare/channelTariffs/images/hxsz.png"/>
 &nbsp;&nbsp;&nbsp;<input type="button" onclick="seach()" value="查询" style="width: 60px;height: 35px;"/>
 </div>
 
</div>

<div class="content"> 


<div class="content_l">

<table class="vote_tb" cellpadding="0" cellspacing="0">
<tr>
<td class="first">
&nbsp;&nbsp; 航班时间
<input type="hidden" id="hsope_Time" name="hsope_Time" value="${sope_Time}"/>
     <%-- <select name="sope_Time" id="sope_Time" class="selectww selectww1" onchange="javaScript:sWeekDate()">
 <c:forEach var="item" items="${listDate}" varStatus="stat">
	<option value="${stat.index}">${item}</optifon>
</c:forEach>
 </select> --%>
<input type="text" id="sope_Time"  onfocus="WdatePicker({skin:'whyGreen',lang:'<s:text name='forms.locale'/>',doubleCalendar:true,dateFmt:'yyyy-MM-dd',minDate: '%y-%M-%d',maxDate:'${maxDate}'});" name="sope_Time" class="Wdate" onchange="sWeekDate()"/>
</td>
<c:forEach var="ls" items="${list_str}" varStatus="stat">
<td id="timetd${stat.index+1}"><a href="#" onclick="showBydate('${ls}')">${ls}</br>
     </a></td>
    </c:forEach>
</tr>

</table>
<input id="text" type="hidden" value="<s:property value="xml"/>"/>
<script type="text/javascript">
 $(function(){
		var xml = document.getElementById('text').value;
		var chart2 = new FusionCharts("<%=request.getContextPath() %>/FusionCharts/MSBar3D.swf", "chartId2", "600", "350");
		chart2.setDataXML(xml);
		chart2.render("chartContainer");
	});
 </script>
<div class="vote vote3" style="width: 100%;moverflow-x:scroll;" id="chartContainer">
<%-- <img src="<%=request.getContextPath()%>/fare/channelTariffs/images/pic1.jpg" /> --%>
</div>
<div style="position:absolute;margin-left: 570px;margin-top: -350px;font-family: 微软雅黑;font-size: 12px;">
	<c:forEach var="ltf" items="${listTobFive}" varStatus="stat">
<div>
	${ltf.spreadsThan}%
</div>
<div>
	${ltf.channelName}
</div>
<%-- <div>
	${ltf.owName}
</div> --%>
<br/>
</c:forEach>
</div>
<div class="clear"></div>
<div class="vote vote4">
<div class="title">周价差TOP3</div>
<ul style="font-family: 微软雅黑;font-size: 12px;">
<li><img src="<%=request.getContextPath()%>/fare/channelTariffs/images/zjc1.gif" />
${cpls[0].qdName}  ${cpls[0].sdate}
<span style="position: absolute;margin-top:-100px;margin-left:-85px;">${cpls[0].hb}</span> <span style="position: absolute;margin-top:-130px;margin-left:-80px;">${cpls[0].jcb}%</span>
</li>
<li><img src="<%=request.getContextPath()%>/fare/channelTariffs/images/zjc2.gif" />
${cpls[1].qdName}  ${cpls[1].sdate}
<span style="position: absolute;margin-top:-100px;margin-left:-85px;">${cpls[1].hb}</span> <span style="position: absolute;margin-top:-130px;margin-left:-80px;">${cpls[1].jcb}%</span>
</li>
<li><img src="<%=request.getContextPath()%>/fare/channelTariffs/images/zjc3.gif" />
${cpls[2].qdName}  ${cpls[2].sdate}
<span style="position: absolute;margin-top:-100px;margin-left:-85px;">${cpls[2].hb}</span> <span style="position: absolute;margin-top:-130px;margin-left:-80px;">${cpls[2].jcb}%</span>
</li>
</ul>
</div>

</div>

<div class="content_r">
<div class="zhouy"> 周运价监控</div>
<div class="icon_1">
	<img src="<%=request.getContextPath()%>/fare/channelTariffs/images/gowhere_icon.gif" />
<div style="margin-left:60px; margin-top: -47px;font-family: 微软雅黑;font-size: 12px;">54</div>
<div style="margin-left: 60px;margin-top: 10px;font-family: 微软雅黑;font-size: 12px;">23</div>

<div style="margin-left:120px; margin-top: -40px;font-family: 微软雅黑;font-size: 12px;">54</div>
<div style="margin-left: 120px;margin-top: 9px;font-family: 微软雅黑;font-size: 12px;">23</div>
</div>
<div class="icon_1">
<img src="<%=request.getContextPath()%>/fare/channelTariffs/images/taobao_icon.gif" />
<div style="margin-left:60px; margin-top: -47px;font-family: 微软雅黑;font-size: 12px;">54</div>
<div style="margin-left: 60px;margin-top: 8px;font-family: 微软雅黑;font-size: 12px;">23</div>

<div style="margin-left:120px; margin-top: -40px;font-family: 微软雅黑;font-size: 12px;">54</div>
<div style="margin-left: 120px;margin-top: 9px;font-family: 微软雅黑;font-size: 12px;">23</div>
</div>

</div>

</div>

<div class="clear"></div>
<div class="bottom">版权所有：广州市恒拓开源有限公司</div>


</div>


</div>
</form>
</body>
</html>
